//导入request.js工具
import request from '@/utils/request.js'

//注册接口函数
export const userRegisterService = (registerData)=>{
    const params = new URLSearchParams()
    for(let i in registerData){
        params.append(i,registerData[i]);
    }
    return request.post('/user/register',params);
}
//登录接口函数
export const userLoginService = (loginData)=>{
    const params = new URLSearchParams()
    for(let i in loginData){
        params.append(i,loginData[i]);
    }
    return request.post('/user/login',params);
}
//获取个人信息
export const userInfoGetService = ()=>{
    return request.get('/user/userInfo');
}
//修改个人资料
export const userInfoUpdateService = (userInfo)=>{
    return request.put('/user/update',userInfo)
}
//修改头像
export const userAvatarUpdateService=(avatarUrl)=>{
    let params = new URLSearchParams();
    params.append('avatarUrl',avatarUrl)
    return request.patch('/user/updateAvatar',params)
}
//修改密码
export const userUpdatePasswordService=(passwordData)=>{
    return request.patch('/user/updatePwd',passwordData)
}